//
//  TeamListView.swift
//  FootballDataRecord
//
//  Created by sea on 2020/1/9.
//  Copyright © 2020 Xx Jiang. All rights reserved.
//

import UIKit

class TeamListView: UIView {

    var dataSource = [TeamModel](){
        didSet{
            tabelView.reloadData()
        }
    }
    @IBOutlet weak var tabelView: UITableView!
    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */
    override func awakeFromNib() {
                super.awakeFromNib()
        tabelView.separatorStyle = .singleLine
    }
//    override class func awakeFromNib() {
//            super.awakeFromNib()
//    }
  
}
extension TeamListView:UITableViewDelegate,UITableViewDataSource{
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return dataSource.count
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let model = dataSource[indexPath.row]
        let cell = UITableViewCell.init(style: .default, reuseIdentifier: "cell")
        cell.detailTextLabel?.font = UIFont.systemFont(ofSize: 13)
        cell.detailTextLabel?.text = model.teamName
        cell.contentView.backgroundColor = #colorLiteral(red: 0.7803862095, green: 0.7803862095, blue: 0.7803862095, alpha: 1)
        return cell
    }
    
    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        
    }
}
